var res [][]int
// 未枝剪
func combine(n int, k int) [][]int {
    res = [][]int{}
    if n <= 0 || k > n || k <= 0 {
        return res
    }
    backTraving(n, k, 1, []int{})
    return res
}

func backTraving(n, k, startIndex int, path []int) {
    if len(path) == k {
        tem := make([]int, k)
        copy(tem, path)
        res = append(res, tem)
        return
    }
    for i:=startIndex; i<=n; i++ {
        path = append(path, i)
        backTraving(n, k, i+1, path)
        path = path[:len(path)-1]
    }
}